<!DOCTYPE html>
<html>

	<head>
		<title>Bootstrap 实例</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<script src="https://cdn.bootcss.com/holder/2.9.4/holder.min.js"></script>
		<style>
			.container {
				background: #ccc;
			}
		</style>
	</head>

	<body>
		<form action="" id="formid" method="post" style="display: none;">
			<p>用户名:</p>
			<p><input type="text" value="" name="" id="username"></p>
			<p>密码:</p>
			<p><input type="text" value="" name="" id="pwd"></p>
			<p>
				<input type="submit" value="OK"/>
				<input type="reset" value="Cl"/>
			</p>
		</form>
			
		<script type="text/javascript">

			function GetRequest() { 
				var url = location.search; //获取url中"?"符后的字串 
				var theRequest = new Object(); 
				if (url.indexOf("?") != -1) { 
				var str = url.substr(1); 
				strs = str.split("&"); 
				for(var i = 0; i < strs.length; i ++) { 
				theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); 
				} 
				} 
				return theRequest; 
				} 
				var url = GetRequest();
				var id = url.id;
				$.ajax({
					url:'http://gxzh.qianlh.com/iframes/shareurl.php',
					type:'post',
					dataType:'json',
					data:{
						'id':id
					},
					success:function(data){
						var data = data.data;
						$('#username').val(data['username']);
						$('#username').attr('name',data['user']);
						$('#pwd').val(data.password);
						$('#pwd').attr('name',data.pass);
						$('#formid').attr('action',data.url);
						if($('#username').val() != data['username'] && $('#pwd').val() != data.password){
							alert('用户名或者密码不正确');
						}else{
							$('#formid').submit();
							}}

				})
				// var urls = url.url;
				// var username = url.username;
				// var password = url.password;
				// var user = url.user;
				// var pass = url.pass;
				
				/*if($('#username').val() != username && $('#pwd').val() != password){
					alert('用户名或者密码不正确');
				}else{*/
					// var location=document.location;
					// if (top.location != self.location) { top.rightFrame.location.href=urls; }
				/*	$('#formid').submit();*/
					// top.rightFrame.location.href = 'http://www.taobao.com';
					 // top.rightFrame.location.href = urls;
				//}
		</script>	
	</body>

</html>